package org.deadline.service.user;

import java.util.List;
import org.deadline.model.user.PersonFilter;
import org.deadline.repository.user.PersonFilterRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class PersonFilterServiceImpl implements PersonFilterService {

	@Autowired
    PersonFilterRepository personFilterRepository;

	public long countAllPersonFilters() {
        return personFilterRepository.count();
    }

	public void deletePersonFilter(PersonFilter personFilter) {
        personFilterRepository.delete(personFilter);
    }

	public PersonFilter findPersonFilter(Long id) {
        return personFilterRepository.findOne(id);
    }

	public List<PersonFilter> findAllPersonFilters() {
        return personFilterRepository.findAll();
    }

	public List<PersonFilter> findPersonFilterEntries(int firstResult, int maxResults) {
        return personFilterRepository.findAll(new org.springframework.data.domain.PageRequest(firstResult / maxResults, maxResults)).getContent();
    }

	public void savePersonFilter(PersonFilter personFilter) {
        personFilterRepository.save(personFilter);
    }

	public PersonFilter updatePersonFilter(PersonFilter personFilter) {
        return personFilterRepository.save(personFilter);
    }
}
